
const int RPin = 9;
const int GPin = 10;
const int BPin = 11;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
}

void loop() {

  while (Serial.available() > 0) {
    switch (Serial.read()) {
      case "R" | "r":
        analogWrite(RPin, Serial.parseInt());
        break;
      case "G" | "g":
        analogWrite(GPin, Serial.parseInt());
        break;
      case "B" | "b":
        analogWrite(BPin, Serial.parseInt());
        break;
    }
  }

}
